#pragma	once

#include "ZCommon.h"

namespace	Z
{

//------------------------------------------------------------------------------------------------------------------------
class	Lockless
{
protected:
	struct	ScopedLock	{
		explicit ScopedLock(const Lockless&)	{}
		explicit ScopedLock(const Lockless*)	{}
	};
};

//------------------------------------------------------------------------------------------------------------------------
class	Lock
{
private:
	typedef	mutex_t::scoped_lock	scoped_lock;
protected:
	class		ScopedLock;
	friend	ScopedLock;
	class	ScopedLock	:	private scoped_lock	{
	public:
		explicit ScopedLock(const Lock& host)	:	scoped_lock(host.mMutex)	{}
		explicit ScopedLock(const Lock* host)	:	scoped_lock(host->mMutex)	{}
	};

private:
	mutable	mutex_t	mMutex;
};

};